Skip to content

chore: add dart format to pre-commit check and CI - #296

Merged
richardthe3rd merged 7 commits into
mainfrom
chore/dart-format
May 19, 2026
Merged

chore: add dart format to pre-commit check and CI#296
richardthe3rd merged 7 commits into
mainfrom
chore/dart-format

Conversation

@richardthe3rd

Copy link
Copy Markdown
Owner

Adds a format mise task (dart format .) and includes it in the
check pre-commit gate. CI gains a dart format --set-exit-if-changed .
step before flutter analyze so unformatted code is a hard failure on
PRs rather than a silent auto-fix.

The local task reformats in place; CI uses --set-exit-if-changed to
fail the build without modifying files.

Copilot AI review requested due to automatic review settings May 19, 2026 20:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an explicit Dart formatting step to both the local pre-commit “check” gate (via mise) and CI, so formatting violations fail fast instead of being silently fixed later. Most of the diff is the resulting dart format reflow across tests and Flutter source.

Changes:

  • Add a mise task to format Dart code (dart format .) and include it in the check pre-commit gate.
  • Add a CI step to enforce formatting (dart format --set-exit-if-changed .) before flutter analyze.
  • Apply formatter-driven reformatting across tests and app code.

Reviewed changes

Copilot reviewed 60 out of 69 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/widgets/overflow_menu_test.dart Formatter reflow in widget tests.
test/widgets/festival_menu_sheets_test.dart Formatter reflow in widget tests.
test/widgets/breadcrumb_bar_test.dart Formatter reflow in widget tests.
test/widgets_test.dart Formatter reflow in widget tests.
test/utils/widget_builders_test.dart Formatter reflow in utils tests.
test/utils/navigation_helpers_test.dart Formatter reflow in utils tests.
test/utils_test.dart Formatter reflow in utils tests.
test/utf8_encoding_test.dart Formatter reflow in UTF-8 handling tests.
test/style_screen_test.dart Formatter reflow in screen tests.
test/style_screen_screenshot_test.dart Formatter reflow in screenshot tests.
test/style_description_helper_test.dart Formatter reflow in helper tests.
test/string_formatting_helper_test.dart Formatter reflow in helper tests.
test/string_comparison_helper_test.dart Formatter reflow in helper tests.
test/storage_service_test.dart Formatter reflow in service/storage tests.
test/services_test.dart Formatter reflow in services tests.
test/screens_test.dart Formatter reflow in screens tests.
test/router_test.dart Formatter reflow in router tests.
test/provider_test.dart Formatter reflow in provider tests.
test/models_test.dart Formatter reflow in model tests.
test/main_test.dart Formatter reflow in app entry tests.
test/info_chip_test.dart Formatter reflow in widget tests.
test/environment_badge_test.dart Formatter reflow in widget tests.
test/drinks_screen_style_filter_test.dart Formatter reflow in screen/filter tests.
test/drink_detail_screen_test.dart Formatter reflow in screen tests.
test/drink_detail_screen_screenshot_test.dart Formatter reflow in screenshot tests.
test/drink_card_test.dart Formatter reflow in widget tests.
test/domain/services/drink_sort_service_test.dart Formatter reflow in domain service tests.
test/domain/services/drink_filter_service_test.dart Formatter reflow in domain service tests.
test/domain/repositories/api_festival_repository_test.dart Formatter reflow in repository tests.
test/brewery_screen_test.dart Formatter reflow in screen tests.
test/beverage_type_helper_test.dart Formatter reflow in helper tests.
test/beer_provider_test.dart Formatter reflow in provider tests.
test/beer_api_service_test.dart Formatter reflow in API service tests.
test/app_theme_test.dart Formatter reflow in theme tests.
test/analytics_service_test.dart Formatter reflow in analytics tests.
test/accessibility_test.dart Formatter reflow in accessibility tests.
mise.toml Add format task and include it in check.
lib/widgets/festival_menu_sheets.dart Formatter reflow in UI code.
lib/widgets/environment_badge.dart Formatter reflow in widget code.
lib/widgets/drink_list_section.dart Formatter reflow in widget code.
lib/widgets/drink_card.dart Formatter reflow in widget code.
lib/utils/url_launcher_helper.dart Formatter reflow in utility code.
lib/utils/style_description_helper.dart Formatter reflow in utility code.
lib/utils/string_comparison_helper.dart Formatter reflow in utility code/comments.
lib/utils/navigation_helpers.dart Formatter reflow in navigation helper signature.
lib/utils/category_color_helper.dart Formatter reflow in utility code.
lib/utils/abv_strength_helper.dart Formatter reflow in utility code.
lib/services/storage_service.dart Formatter reflow in service code.
lib/services/festival_service.dart Formatter reflow in service code.
lib/services/environment_service.dart Formatter reflow in service code/comments.
lib/services/beer_api_service.dart Formatter reflow in service code.
lib/services/analytics_service.dart Formatter reflow in service code.
lib/screens/style_screen.dart Formatter reflow in screen code.
lib/screens/festival_info_screen.dart Formatter reflow in screen code.
lib/screens/drinks_screen.dart Formatter reflow in screen code.
lib/screens/drink_detail_screen.dart Formatter reflow in screen code.
lib/screens/brewery_screen.dart Formatter reflow in screen code.
lib/screens/about_screen.dart Formatter reflow in screen code.
lib/router.dart Formatter reflow in router config.
lib/providers/beer_provider.dart Formatter reflow in provider code.
lib/models/festival.dart Formatter reflow in model code.
lib/models/drink.dart Formatter reflow in model code.
lib/main.dart Formatter reflow in app entry / widgets.
lib/firebase_options.dart Formatter cleanup (trailing whitespace/newlines).
lib/domain/services/drink_filter_service.dart Formatter reflow in domain service code.
lib/constants.dart Formatter reflow of constant declaration.
lib/app_theme.dart Formatter reflow in theme code.
AGENTS.md Document new format task usage.
.github/workflows/ci.yml Add formatting check step to CI.

Comment thread .github/workflows/ci.yml
Comment on lines +68 to +70
- name: Check formatting
run: dart format --set-exit-if-changed .

Comment thread mise.toml Outdated
Comment on lines 47 to 54
[tasks.format]
description = "Format all Dart code in place"
run = 'dart format .'

[tasks.check]
description = "Pre-commit gate: generate → analyze + test (run before every commit)"
depends = ['analyze', 'test']
description = "Pre-commit gate: generate → format + analyze + test (run before every commit)"
depends = ['format', 'analyze', 'test']
run = 'echo "All checks passed"'
@github-actions

github-actions Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

LCOV of commit 77eca54 during CI #241

Summary coverage rate:
  lines......: 80.8% (2624 of 3246 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate:
                                                      |Lines       |Functions  |Branches    
  Filename                                            |Rate     Num|Rate    Num|Rate     Num
  ==========================================================================================
  lib/app_theme.dart                                  | 0.0%     48|    -     0|    -      0
  lib/domain/services/drink_filter_service.dart       | 0.0%     51|    -     0|    -      0
  lib/firebase_options.dart                           |    -      0|    -     0|    -      0
  lib/main.dart                                       | 0.0%    120|    -     0|    -      0
  lib/models/drink.dart                               | 0.0%    124|    -     0|    -      0
  lib/models/festival.dart                            | 0.0%    129|    -     0|    -      0
  lib/providers/beer_provider.dart                    | 0.0%    291|    -     0|    -      0
  lib/router.dart                                     | 0.0%     72|    -     0|    -      0
  lib/screens/about_screen.dart                       | 0.0%    129|    -     0|    -      0
  lib/screens/brewery_screen.dart                     | 0.0%     65|    -     0|    -      0
  lib/screens/drink_detail_screen.dart                | 0.0%    192|    -     0|    -      0
  lib/screens/drinks_screen.dart                      | 0.0%    264|    -     0|    -      0
  lib/screens/festival_info_screen.dart               | 0.0%     97|    -     0|    -      0
  lib/screens/style_screen.dart                       | 0.0%     66|    -     0|    -      0
  lib/services/analytics_service.dart                 | 0.0%     44|    -     0|    -      0
  lib/services/beer_api_service.dart                  | 0.0%     40|    -     0|    -      0
  lib/services/environment_service.dart               | 0.0%      2|    -     0|    -      0
  lib/services/festival_service.dart                  | 0.0%     37|    -     0|    -      0
  lib/services/storage_service.dart                   | 0.0%     43|    -     0|    -      0
  lib/utils/abv_strength_helper.dart                  | 0.0%     17|    -     0|    -      0
  lib/utils/category_color_helper.dart                | 0.0%     25|    -     0|    -      0
  lib/utils/navigation_helpers.dart                   | 0.0%     47|    -     0|    -      0
  lib/utils/string_comparison_helper.dart             | 0.0%      2|    -     0|    -      0
  lib/utils/style_description_helper.dart             | 0.0%     11|    -     0|    -      0
  lib/utils/url_launcher_helper.dart                  | 0.0%     11|    -     0|    -      0
  lib/widgets/drink_card.dart                         | 0.0%    139|    -     0|    -      0
  lib/widgets/drink_list_section.dart                 | 0.0%     55|    -     0|    -      0
  lib/widgets/environment_badge.dart                  | 0.0%     25|    -     0|    -      0
  lib/widgets/festival_menu_sheets.dart               | 0.0%    176|    -     0|    -      0

@codecov

codecov Bot commented May 19, 2026

Copy link
Copy Markdown

claude added 6 commits May 19, 2026 20:42
Adds a `format` mise task (`dart format .`) and includes it in the
`check` pre-commit gate. CI gains a `dart format --set-exit-if-changed .`
step before `flutter analyze` so unformatted code is a hard failure on
PRs rather than a silent auto-fix.

The local task reformats in place; CI uses `--set-exit-if-changed` to
fail the build without modifying files.
Bulk-format all Dart files with `dart format .`. No logic changes —
line wrapping, trailing whitespace, and indentation only.
Splits the single `format` task into three named sub-tasks:
- `dart:format` — dart format . (use --no-deps for speed after Dart changes)
- `prettier:format` — Prettier for JS/TS/MJS files
- `mise:format` — mise fmt for mise.toml

The top-level `format` task now depends on all three. CI check
formatting step expanded to cover all three. Prettier added to root
package.json; .prettierignore excludes build/, android/, ios/.
- Add --output=none to dart format CI check so it doesn't modify
  files (--set-exit-if-changed alone still writes)
- Remove mise fmt --check from CI: mise is not installed in the CI
  environment (setup-flutter-app uses subosito/flutter-action directly)
- Make dart:format depend on generate so mock files are formatted
  after codegen, not before
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Cloudflare Pages Preview

Your preview deployment is ready!

Preview URL: https://chore-dart-format.staging-cambeerfestival.pages.dev

This preview will be automatically updated when you push new commits to this PR.

@richardthe3rd
richardthe3rd merged commit 3418286 into main May 19, 2026
15 of 16 checks passed
@richardthe3rd
richardthe3rd deleted the chore/dart-format branch May 19, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants